package sequency;


public class Data implements Operation {

    int[] data = new int[10];

    public int usedsize;

    @Override
    public void set(int num , int pos) {
        data[pos] = num;
        usedsize = pos+1;
    }

    @Override
    public void add(int num , int pos) {
        for (int i = pos; i < usedsize; i++) {
            data[i+1] = data[i];
        }
        data[pos] = num;
        usedsize++;
    }

    @Override
    public void del(int pos) {
        for (int i = pos; i < usedsize; i++) {
            data[i] = data[i+1];
        }
        usedsize--;
    }

    @Override
    public void remove(int num, int pos) {
        data[pos] = num;
    }

    @Override
    public int find(int pos) {
        return data[pos];
    }

    @Override
    public void show() {
        for (int i = 0; i < usedsize; i++) {
            System.out.print(data[i]+" ");
        }
        System.out.println();
    }
}
